import 'package:flutter/material.dart';
import 'package:flutter_widget/src/config/color_define.dart';
import 'package:flutter_widget/src/widget/tap_widget.dart';
import '../../config/assets.dart';

/*加载失败，点击重试页面*/
class PageViewFailWidget extends StatelessWidget {
  final void Function()? onPressed;
  final String? message;

  const PageViewFailWidget({Key? key, required this.onPressed, this.message})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return TapWidget(
      onTap: () {
        onPressed?.call();
      },
      child: Column(children: [
        Expanded(
            child: Container(
          alignment: Alignment.bottomCenter,
          child: FWAssets.emptyIcon,
        )),
        Expanded(
            child: Container(
          alignment: Alignment.topCenter,
          padding: const EdgeInsets.fromLTRB(0, 12, 0, 0),
          child: Text(
            message ?? '对不起，你访问的内容失联了(*＞﹏＜*)',
            style: const TextStyle(
              color: FWColorPicker.textFFAAAAAA,
              fontSize: 14,
              decoration: TextDecoration.none,
            ),
          ),
        ))
      ]),
    );
  }
}
